package com.fzz.netty.study.ws.global;

import io.netty.channel.Channel;
import io.netty.channel.ChannelId;
import io.netty.channel.group.ChannelMatcher;

import java.util.Collection;

/**
 * @author fankai
 * @version 1.0
 * @classname SendChannelMatcher
 * @description TODO
 * @date 2021/11/02 10:14
 **/
public class SendChannelMatcher implements ChannelMatcher {
    private Collection<ChannelId> channelIdSet;


    @Override
    public boolean matches(Channel channel) {
        if (channelIdSet.contains(channel.id())) {
            return true;
        }
        return false;
    }

    public SendChannelMatcher() {
    }

    public SendChannelMatcher(Collection<ChannelId> channelIdSet) {
        this.channelIdSet = channelIdSet;
    }

    public Collection<ChannelId> getChannelIdSet() {
        return channelIdSet;
    }

    public void setChannelIdSet(Collection<ChannelId> channelIdSet) {
        this.channelIdSet = channelIdSet;
    }
}
